package com.jl.dao;

import com.jl.bean.CustormerBean;
import com.mchange.v2.c3p0.ComboPooledDataSource;
import org.apache.commons.dbutils.QueryRunner;
import org.apache.commons.dbutils.handlers.BeanHandler;

import javax.sql.DataSource;
import java.sql.SQLException;

public class LoginDao {
    public CustormerBean isLogin(String username, String password) throws SQLException {
        DataSource dataSource = new ComboPooledDataSource();
        QueryRunner queryRunner = new QueryRunner(dataSource);
        String sql="select * from custorm where username='"+username+"' and pwd='"+password+"'";
        CustormerBean customer = queryRunner.query(sql, new BeanHandler<CustormerBean>(CustormerBean.class));
        System.out.println(customer);
        return customer;
    }
}
